<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Usuario Details</f:facet>


        <s:decorate id="login" template="layout/display.xhtml">
            <ui:define name="label">Login</ui:define>
            <h:outputText value="#{usuarioHome.instance.login}"/>
        </s:decorate>

        <s:decorate id="tipo" template="layout/display.xhtml">
            <ui:define name="label">Tipo</ui:define>
            <h:outputText value="#{usuarioHome.instance.tipo}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/UsuarioEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty usuarioFrom ? 'UsuarioList' : usuarioFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Avisos</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="avisosChildren">

        <h:outputText value="There are no avisos associated with this usuario."
                   rendered="#{empty usuarioHome.avisos}"/>

        <rich:dataTable value="#{usuarioHome.avisos}"
                       var="_aviso"
                  rendered="#{not empty usuarioHome.avisos}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="avisosTable">
            <rich:column sortBy="#{_aviso.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_aviso.id}"/>
            </rich:column>
            <rich:column sortBy="#{_aviso.dataCriacao}">
                <f:facet name="header">Data criacao</f:facet>
                <h:outputText value="#{_aviso.dataCriacao}"/>
            </rich:column>
            <rich:column sortBy="#{_aviso.dataExpiracao}">
                <f:facet name="header">Data expiracao</f:facet>
                <h:outputText value="#{_aviso.dataExpiracao}"/>
            </rich:column>
            <rich:column sortBy="#{_aviso.texto}">
                <f:facet name="header">Texto</f:facet>
                <h:outputText value="#{_aviso.texto}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectaviso"
                     value="Select"
                      view="/Aviso.xhtml">
                    <f:param name="avisoId"
                            value="#{_aviso.id}"/>
                    <f:param name="avisoFrom" value="Usuario"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add aviso"
                view="/AvisoEdit.xhtml">
            <f:param name="usuarioId"
                    value="#{usuarioHome.instance.id}"/>
            <f:param name="avisoFrom" value="Usuario"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Incidentes</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="incidentesChildren">

        <h:outputText value="There are no incidentes associated with this usuario."
                   rendered="#{empty usuarioHome.incidentes}"/>

        <rich:dataTable value="#{usuarioHome.incidentes}"
                       var="_incidente"
                  rendered="#{not empty usuarioHome.incidentes}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="incidentesTable">
            <rich:column sortBy="#{_incidente.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_incidente.id}"/>
            </rich:column>
            <rich:column sortBy="#{_incidente.data}">
                <f:facet name="header">Data</f:facet>
                <h:outputText value="#{_incidente.data}"/>
            </rich:column>
            <rich:column sortBy="#{_incidente.descricao}">
                <f:facet name="header">Descricao</f:facet>
                <h:outputText value="#{_incidente.descricao}"/>
            </rich:column>
            <rich:column sortBy="#{_incidente.prioridade}">
                <f:facet name="header">Prioridade</f:facet>
                <h:outputText value="#{_incidente.prioridade}"/>
            </rich:column>
            <rich:column sortBy="#{_incidente.status}">
                <f:facet name="header">Status</f:facet>
                <h:outputText value="#{_incidente.status}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectincidente"
                     value="Select"
                      view="/Incidente.xhtml">
                    <f:param name="incidenteId"
                            value="#{_incidente.id}"/>
                    <f:param name="incidenteFrom" value="Usuario"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add incidente"
                view="/IncidenteEdit.xhtml">
            <f:param name="usuarioId"
                    value="#{usuarioHome.instance.id}"/>
            <f:param name="incidenteFrom" value="Usuario"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Respostas</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="respostasChildren">

        <h:outputText value="There are no respostas associated with this usuario."
                   rendered="#{empty usuarioHome.respostas}"/>

        <rich:dataTable value="#{usuarioHome.respostas}"
                       var="_resposta"
                  rendered="#{not empty usuarioHome.respostas}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="respostasTable">
            <rich:column sortBy="#{_resposta.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_resposta.id}"/>
            </rich:column>
            <rich:column sortBy="#{_resposta.data}">
                <f:facet name="header">Data</f:facet>
                <h:outputText value="#{_resposta.data}"/>
            </rich:column>
            <rich:column sortBy="#{_resposta.texto}">
                <f:facet name="header">Texto</f:facet>
                <h:outputText value="#{_resposta.texto}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectresposta"
                     value="Select"
                      view="/Resposta.xhtml">
                    <f:param name="respostaId"
                            value="#{_resposta.id}"/>
                    <f:param name="respostaFrom" value="Usuario"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add resposta"
                view="/RespostaEdit.xhtml">
            <f:param name="usuarioId"
                    value="#{usuarioHome.instance.id}"/>
            <f:param name="respostaFrom" value="Usuario"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
